from flask import request
import json
import os
import uuid

def get_data():
    data = request.data
    if data:
        data = json.loads(data)
    else:
        data = request.form
    return data

class Myfile:
    def __init__(self):
        self.dir = '../static/files/'
    # 重命名
    def rename(self,filename):
        name = os.path.splitext(filename)[1]
        fname = uuid.uuid4().hex+name
        return fname

myf = Myfile()

# def get_data():
#     data = request.data
#     if data:
#         data = json.loads(data)
#     else:
#         data = request.form
#     return data